require recipes-kernel/linux/linux-mainline-common.inc

SUMMARY = "Allwinner D1 dev kernel recipe"

SRCREV_meta ?= "b7fc5d5cecaad5d97164bac8db5b5ee72f563bb0"
#SRCREV_machine ?= "ca67838d84af4c9f85d06311c9e98e1adf46308f"

LINUX_VERSION = "6.1"
LINUX_SUBVERSION = ".72"
LINUX_TARBASE = "linux-${LINUX_VERSION}${LINUX_SUBVERSION}"
LINUX_TARNAME = "${LINUX_TARBASE}.tar.xz"

KMETA = "kernel-meta"

# It is necessary to add to SRC_URI link to the 'yocto-kernel-cache' due to
# override of the original SRC_URI:
# "do_kernel_metadata: Check the SRC_URI for meta-data repositories or
# directories that may be missing"
SRC_URI = " https://cdn.kernel.org/pub/linux/kernel/v6.x/${LINUX_TARNAME};name=kernel  \
            git://git.yoctoproject.org/yocto-kernel-cache;protocol=https;type=kmeta;name=meta;branch=master;destsuffix=${KMETA} \
           "
SRC_URI[kernel.sha256sum] = "98dce69077c35cffca799dcdbbd32a02242aad6b0950eb931936bb2ef69f0926"

SRC_URI += " \
        file://${LINUX_VERSION}/${LINUX_VERSION}${LINUX_SUBVERSION}/0001-d1h-for-6-1-72-r2.patch \
        file://${LINUX_VERSION}/nezha_defconfig \
    "
#

LINUX_TARGET = ""
LINUX_RELEASE = "r1.0"

PV = "${LINUX_VERSION}${LINUX_SUBVERSION}"
S = "${WORKDIR}/${LINUX_TARBASE}"

KERNEL_FEATURES += "features/cgroups/cgroups.cfg"
KERNEL_FEATURES += "ktypes/standard/standard.cfg"

KERNEL_VERSION_SANITY_SKIP="1"

COMPATIBLE_MACHINE = "(d1h|nezha-allwinner-d1|mangopi-mq-pro)"
#LINUX_VERSION_EXTENSION:append:d1h = "-nezha"
#LINUX_VERSION_EXTENSION:append:mangopi-mq-pro = "-mangopi"

## Should be oveerriten in machine conf
#KBUILD_DEFCONFIG = "defconfig"

KERNEL_DEVICETREE ?= " \
    allwinner/sun20i-d1-nezha.dtb \
    allwinner/sun20i-d1-dongshan-nezha-stu.dtb \
    allwinner/sun20i-d1-mangopi-mq-pro.dtb \
    allwinner/sun20i-d1-lichee-rv.dtb \
    allwinner/sun20i-d1-lichee-rv-dock.dtb \
    allwinner/sun20i-d1-lichee-rv-dock.dtb \
    "

KERNEL_DEPLOYSUBDIR = "${LINUX_TARBASE}"
